package com.txsj.scan.http;

import com.txsj.scan.bean.AllocationApplyBean;
import com.txsj.scan.bean.AllocationApplyDetailsBean;
import com.txsj.scan.bean.AllocationBatchBean;
import com.txsj.scan.bean.AllocationDetailsBean;
import com.txsj.scan.bean.AllocationListBean;
import com.txsj.scan.bean.BaseListResult;
import com.txsj.scan.bean.BaseResult;
import com.txsj.scan.bean.CodeBean;
import com.txsj.scan.bean.CompanyBean;
import com.txsj.scan.bean.EmployeeBean;
import com.txsj.scan.bean.EpcGoodsInfo;
import com.txsj.scan.bean.EpcInfo;
import com.txsj.scan.bean.EpcTagBean;
import com.txsj.scan.bean.GlobalGoodsInfo;
import com.txsj.scan.bean.GoodsClassify;
import com.txsj.scan.bean.GoodsInfo;
import com.txsj.scan.bean.InventoryBatchBean;
import com.txsj.scan.bean.InventoryIdBean;
import com.txsj.scan.bean.LoginBean;
import com.txsj.scan.bean.LoginV2Bean;
import com.txsj.scan.bean.PreBindBean;
import com.txsj.scan.bean.SimpleBatchBean;
import com.txsj.scan.bean.TagGroupInfo;
import com.txsj.scan.bean.UpdateBean;
import com.txsj.scan.bean.VerifyCodeBean;
import com.txsj.scan.bean.WarehouseBean;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.HeaderMap;
import retrofit2.http.POST;
import retrofit2.http.QueryMap;
import retrofit2.http.Url;

public interface ApiServer {
    //EPC获取
    @GET(UrlInterface.getEpcDataURL)
    Observable<BaseListResult<EpcInfo>> getEpcListUrl(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> param);

    //EPC获取
    @GET(UrlInterface.getGoodsDataURL)
    Observable<BaseListResult<EpcGoodsInfo>> getEpcGoodsListUrl(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> param);

    //验证手机号是否能登录
    @GET(UrlInterface.verifyCode)
    Observable<VerifyCodeBean> verifyPhone(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> param);

    //验证手机号是否能登录
    @GET(UrlInterface.getVerifyCode)
    Observable<CodeBean> getVerifyCode(@QueryMap Map<String, String> param);

    //获取手机验证码
    @GET(UrlInterface.login)
    Observable<LoginBean> login(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> param);

    //获取仓库列表
    @GET(UrlInterface.getWareHouse)
    Observable<BaseListResult<WarehouseBean>> getWareHouse(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> params);

    //提交调拨列表
    @POST(UrlInterface.commitAllocateGoods)
    @FormUrlEncoded
    Observable<BaseResult<Object>> commitAllocateGoods(@HeaderMap Map<String, String> header, @FieldMap Map<String, String> params);

    //指定商品库存
    @GET(UrlInterface.goodsInventory)
    Observable<BaseListResult<WarehouseBean>> goodsInventory(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> params);

    //商品左侧分类列表
    @GET(UrlInterface.getGoodsClassList)
    Observable<BaseListResult<GoodsClassify>> getGoodsType(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> params);

    //获取右侧商品列表
    @GET(UrlInterface.getGoodsList)
    Observable<BaseListResult<GoodsInfo>> getGoodsList(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> params);

    //获取商品库存列表
    @GET(UrlInterface.getGoodsInventoryList)
    Observable<BaseListResult<GoodsInfo>> getGoodsInventoryList(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> params);

    //获取商品库存列表
    @GET(UrlInterface.goodsBatchInventory)
    Observable<BaseListResult<InventoryBatchBean>> goodsBatchInventory(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> params);

    //获取所有商品分类[指定仓库]
    @GET(UrlInterface.getWarehouseGoodsClassify)
    Observable<BaseListResult<GoodsClassify>> getWarehouseGoodsClassify(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> params);

    //提交新增批次
    @POST(UrlInterface.commitBatchInfo)
    @FormUrlEncoded
    Observable<BaseResult<InventoryBatchBean>> commitBatchInfo(@HeaderMap Map<String, String> header, @FieldMap Map<String, String> params);

    //获取所有商品分类[指定仓库]
    @POST(UrlInterface.getInventoryIdList)
    @FormUrlEncoded
    Observable<BaseListResult<InventoryIdBean>> getInventoryIdList(@HeaderMap Map<String, String> header, @FieldMap Map<String, String> params); //获取所有商品分类[指定仓库]

    @POST(UrlInterface.commitInventoryChangeList)
    @FormUrlEncoded
    Observable<BaseResult> commitInventoryChangeList(@HeaderMap Map<String, String> header, @FieldMap Map<String, String> params);

    //根据商品条码获取商品数据
    @GET(UrlInterface.getGlobalListForCache)
    Observable<BaseListResult<GlobalGoodsInfo>> getGlobalListForCache(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> params);

    //根据商品条码获取商品数据
    @GET(UrlInterface.getBarCodeGoods)
    Observable<BaseListResult<GoodsInfo>> getBarCodeGoods(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> params);

    //根据商品二维码获取标签信息
    @GET(UrlInterface.getQrCodeHttp)
    Observable<BaseResult<EpcInfo>> getQrCodeHttp(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> params);

    //根据商品条码获取商品数据
    @GET(UrlInterface.URLFromcodeGetGoodsDaa)
    Observable<BaseListResult<GoodsInfo>> getGoodsData(@QueryMap Map<String, String> params);

    //搜索商品
    @GET(UrlInterface.searchGoods)
    Observable<BaseListResult<GoodsInfo>> searchGoods(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> param);

    //EPC获取[字节流的形式]
    @GET(UrlInterface.getEpcDataURL)
    Call<ResponseBody> getEpcByteListUrl(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> param);

    //EPC获取[字节流的形式]
    @GET(UrlInterface.getEpcDataURL)
    Call<ResponseBody> getEpcGoodsByteListUrl(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> param);

    //根据商品条码获取商品数据[字节流的形式]
    @GET(UrlInterface.getGlobalListForCache)
    Call<ResponseBody> getGlobalListByteForCache(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> params);

    //获取商品库存列表[字节流形式]
    @GET(UrlInterface.getGoodsInventoryList)
    Call<ResponseBody> getGoodsInventoryBytesList(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> params);

    //获取企业列表
    @GET(UrlInterface.getCompanyList)
    Observable<BaseListResult<CompanyBean>> getCompanyList(@HeaderMap Map<String, String> header, @QueryMap
            Map<String,
                    String> params);

    //验证手机号是否可以登录
    @GET(UrlInterface.ifMobileCanloginV2)
    Observable<VerifyCodeBean> getIfCanLogin(@HeaderMap Map<String, String> header,
                                             @QueryMap Map<String, String> params);

    //登录
    @GET(UrlInterface.loginV2)
    Observable<LoginV2Bean> loginV2(@HeaderMap Map<String, String> header,
                                    @QueryMap Map<String, String> params);

    //绑定标签选择商品后，选择批次
    @GET(UrlInterface.getBatch)
    Observable<BaseListResult<SimpleBatchBean>> getBatch(@HeaderMap Map<String, String> header,
                                                         @QueryMap Map<String, String> params);

    //绑定标签商品
    @POST(UrlInterface.bindGoodsBatch)
    @FormUrlEncoded
    Observable<BaseResult> bindGoodsBatch(@HeaderMap Map<String, String> header,
                                          @FieldMap Map<String, String> params);

    //解绑标签
    @GET(UrlInterface.unBindGoodsBatch)
    Observable<BaseResult> unBindGoodsBatch(@HeaderMap Map<String, String> header,
                                            @QueryMap Map<String, String> params);

    //获取标签信息
    @GET(UrlInterface.getRFIDDetail)
    Observable<BaseResult<EpcInfo>> getRFIDDetail(@HeaderMap Map<String, String> header, @QueryMap
            Map<String, String> params);

    //获取标签组信息
    @GET(UrlInterface.getTagGroupList)
    Observable<BaseListResult<TagGroupInfo>> getTagGroupList(@HeaderMap Map<String, String> header, @QueryMap
            Map<String, String> params);

    //检查版本更新
    @GET(UrlInterface.getCheckVersion)
    Observable<BaseListResult<UpdateBean>> getVersionUpdate(@HeaderMap Map<String, String> header, @QueryMap
            Map<String, String> params);


    /**
     * 新的请求方式：2019/01/27
     * get请求不变，
     * post请求：
     * 将brand_token、timestamp、sign拼到连接后面
     * 其他请求参数放到函数体中，不变（brand_token不能既拼又传）
     * 保证timestamp的唯一性
     *
     * @param header
     * @param params
     * @return
     */

//  @POST(UrlInterface.preBindLabel)
    @POST
    @FormUrlEncoded
    Observable<BaseResult<PreBindBean>> preBindLabel(@Url String url,
                                                     @HeaderMap Map<String, String> header,
                                                     @FieldMap Map<String, String> params);

    //网关测试
    @GET(UrlInterface.test)
    Call<ResponseBody> test(@HeaderMap Map<String, String> header, @QueryMap Map<String, String> param);

    //视频设备解密
    @POST
    @FormUrlEncoded
    Call<ResponseBody> encryptDevice(@Url String url, @FieldMap Map<String, String> param);


    //获取调拨单历史
    @GET(UrlInterface.URLGetAllocationList)
    Observable<BaseListResult<AllocationListBean>> getAllocateHistory(@HeaderMap Map<String, String> header, @QueryMap
            Map<String, String> params);


    //获取调拨单详情
    @GET(UrlInterface.URLGetAllocationListDetails)
    Observable<BaseResult<AllocationDetailsBean>> getAllocationListDetails(@HeaderMap Map<String, String> header,
                                                                           @QueryMap Map<String, String> map);

    //根据标签TagID 查询标签是否可以进行调拨和盘点操作
    @POST
    @FormUrlEncoded
    Observable<BaseListResult<EpcTagBean>> checkEpcCanTake(@Url String url,
                                                           @HeaderMap Map<String, String> header,
                                                           @FieldMap Map<String, String> params);

    //获取本品牌下所有待入库和待出库的tagID
    @GET(UrlInterface.URLGetAllEpcTagIds)
    Call<ResponseBody> getAllEpcTagIds(@HeaderMap Map<String, String> header,
                                       @QueryMap Map<String, String> map);

    //获取调拨申请单列表数据
    @GET(UrlInterface.URLGetAllocationList)
    Observable<BaseListResult<AllocationApplyBean>> getAllocationApplyList(@HeaderMap Map<String, String> header,
                                                                           @QueryMap Map<String, String> map);

    //获取调拨申请单详情
    @GET(UrlInterface.URLAllocationFormDetails)
    Observable<BaseResult<AllocationApplyDetailsBean>> getAllocationApplyDetails(@HeaderMap Map<String, String> header,
                                                                                 @QueryMap Map<String, String> map);

    //获取品牌员工列表
    @GET(UrlInterface.URLGetMemberList)
    Observable<BaseListResult<EmployeeBean>> getEmployeeList(@HeaderMap Map<String, String> header,
                                                             @QueryMap Map<String, String> map);

    //操作调拨状态
    @GET(UrlInterface.URLTakeAllocationFormStates)
    Call<ResponseBody> setAllocationFromStates(@HeaderMap Map<String, String> header,
                                               @QueryMap Map<String, String> map);

    //获取品牌员工列表
    @GET(UrlInterface.URLGetAllocationBatchList)
    Observable<BaseListResult<AllocationBatchBean>> getAllocationBatchList(@HeaderMap Map<String, String> header,
                                                                           @QueryMap Map<String, String> map);


    //调拨申请单添加
    @POST
    @FormUrlEncoded
    Call<ResponseBody>  allocationCheckStatus(@Url String url,@HeaderMap Map<String, String> header, @FieldMap Map<String, String> params);

}
